<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="basePath" value="${pageContext.request.contextPath}" scope="page"></c:set>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>神州待审核订单页面</title>

 <%@ include file="../../jsp/common.jsp" %> 
 
 <script type="text/javascript" >
	var url;
	
	function searchUser(){
		$("#dg").datagrid('load',{
			"userName":$("#s_userName").val()
		});
	}
	
	
	//增加用户
	function openUserAddDialog(){
		$("#dlg").dialog("open").dialog("setTitle","添加用户信息");
		url="${basePath}/saveUser";
	}
	
	
	function saveUser(){
		$("#fm").form("submit",{
			url:url,
		  	onSubmit:function(){
				return $(this).form("validate");
			},  
			success:function(result){		
				if(result.success){
					$.messager.alert("系统提示","保存成功");
					resetValue();
					$("#dlg").dialog("close");
					$("#dg").datagrid("reload");
				}else{
					$.messager.alert("系统提示","保存失败");
					return;
				}
			}
		});
	}
	
//	删除用户
	function deleteUser(){
		var selectedRows=$("#dg").datagrid('getSelections');
		if(selectedRows.length==0){
			$.messager.alert("系统提示","请选择要删除的数据！");
			return;
		}
		var strIds=[];
		for(var i=0;i<selectedRows.length;i++){
			//迭代选中行中的ID
			strIds.push(selectedRows[i].userId);
			
		}
		var ids=strIds.join(",");
		$.messager.confirm("系统提示","您确认要删除这<font color=red>"+selectedRows.length+"</font>条数据吗？",function(r){
			if(r){
				$.post("${pageContext.request.contextPath}/deleteUser",
						{ids:ids},
						function(result){
					if(result.success){
						$.messager.alert("系统提示","数据已成功删除！");
						$("#dg").datagrid("reload");
					}else{
						$.messager.alert("系统提示","数据删除失败！");
					}
				},"json");
			}
		});
		
	}
	
//	修改用户数据
	function openUserModifyDialog(){
		var selectedRows=$("#dg").datagrid('getSelections');
		if(selectedRows.length!=1){
			$.messager.alert("系统提示","请选择一条要编辑的数据！");
			return;
		}
		var row=selectedRows[0];
		$("#dlg").dialog("open").dialog("setTitle","编辑用户信息");
		$('#fm').form('load',row);
		url="${basePath}/updateKey/"+row.userId;
	}
	
	//重置数据
	function resetValue(){
		$("#userName").val("");
		$("#password").val("");
		$("#email").val("");
		$("#age").val("");
		$("#sex").val("");
		$("#idCard").val("");
		$("#wechat").val("");
		$("#tenqq").val("");
	}
	
	function closeUserDialog(){
		$("#dlg").dialog("close");
		resetValue();
	}
	 //图片审核
 	 function  checkImage(val,row){
		name = row.name;
		return '<a  href="${basePath}/checkImage/'+name+'">'+'<font color=blue>'+"查看图片"+'</font>'+'</a>';
	}   
	 
 	function  checkImage1(val,row){
		name = row.name;
		return '<a  href="${basePath}/checkImage1/'+name+'">'+'<font color=blue>'+"查看图片1"+'</font>'+'</a>';
	}  
 	
 	function  checkImage2(val,row){
		name = row.name;
		return '<a  href="${basePath}/checkImage2/'+name+'">'+'<font color=blue>'+"查看图片2"+'</font>'+'</a>';
	}  
 </script>
 
</head>
<!-- 动态加载后台数据 -->
<body style="margin:1px;">
	<table id="dg" title="订单管理" class="easyui-datagrid"
	 fitColumns="true" pagination="true" rownumbers="true"
	 url="${basePath}/noCheckData2" fit="true" toolbar="#tb">
	 <thead>
	 	<tr>
	 	<th field="cb" checkbox="true" align="center"></th>
	 		<th field="name" width="5" align="center" sortable="true">车主姓名</th>
	 		<th field="mobile" width="5" align="center" sortable="true">车主电话</th>
	 		<th field="platenumbers" width="5" align="center" sortable="true">车牌号码</th>
	 		<th field="product" width="5" align="center" sortable="true">产品类型</th>
	 		<th field="genre" width="5" align="center" sortable="true">产品期限</th>
	 		<th field="type" width="5" align="center" sortable="true">订单状态</th>
	 		<th field="addtime" width="5" align="center" sortable="true">申请日期</th>
	 		<th field="affiliationWangdian" width="5" align="center" sortable="true">所属网点</th>
	 		<th field="affiliationYewu" width="5" align="center" sortable="true">所属业务</th>
	 		<th  data-options="field:'img0202',formatter:checkImage" width="10" align="center" sortable="true">照片审核</th> 
	 		
	 
	 	</tr>
	 </thead>
	</table>
	
	<!-- 增删改查按扭
	<div id="tb">
		<div>
			<a href="javascript:openUserModifyDialog()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">添加放款金额</a>
		</div> 
	</div> -->
	
	<!-- 增删改查按扭 -->
	<div id="tb">
		<div>
			&nbsp;用户名：&nbsp;<input type="text" id="s_userName" size="20" onkeydown="if(event.keyCode==13) searchUser()"/>
			<a href="javascript:searchUser()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
		</div>
	</div>
	
	<!-- 增加用户界面 start-->
	<div id="dlg" class="easyui-dialog" style="width: 620px;height:250px;padding: 10px 20px"
	  closed="true" buttons="#dlg-buttons">
	 	<form id="fm" method="post">
	 		<table cellspacing="8px">
	 			<tr>
	 				<td>用户名：</td>
	 				<td><input type="text" id="userName" name="userName" class="easyui-validatebox" required="true"/>&nbsp;<font color="red">*</font></td>
	 				<td>密码：</td>
	 				<td><input type="password"  id="password" name="password" class="easyui-validatebox" required="true"/>&nbsp;<font color="red">*</font></td>
	 			</tr>
	 			<tr>
	 				<td>年龄：</td>
	 				<td><input type="text" id="age" name="age" class="easyui-validatebox"  /></td>
	 				
	 				<td>性别：</td>
	 				<td>
	 					<select class="easyui-combobox" id="sex" name="sex"  class="easyui-validatebox" required="true" editable="false" panelHeight="auto">
	 						<option value="男">男</option>
	 						<option value="妇">女</option>
	 					</select>&nbsp;<font color="red">*</font>
	 				</td>
	 					</tr>
	 			<tr>
	 			
	 				<td>邮箱：</td>
	 				<td>
	 				<input type="text" id="email" name="email" class="easyui-validatebox" validType="email"/>
	 				</td>
	 				<td>QQ号码 ：</td>
	 				<td><input type="text" id="tenqq" name="tenqq" class="easyui-validatebox"  /></td>
	  
	 			</tr>
	 			<tr>
	 				<td>身份证号： </td>
	 				<td>
	 				<input type="text" id="idCard" name="idCard" class="easyui-validatebox" />
	 				</td>
	 				<td>微信号：</td>
	 				<td><input type="text" id="wechat" name="wechat" class="easyui-validatebox"  /></td>
	 			</tr>
	 			<tr>
	 				<td>地址 ：</td>
	 				<td>
	 				<input type="text" id="address" name="address" class="easyui-validatebox" />
	 				</td>
	 				<td>账号 ：</td>
	 				<td>
	 				<input type="text" id="account" name="account" class="easyui-validatebox" />
	 				</td>
	 			</tr>
	 		</table>
	 	</form>
	</div>
	
	<!-- 保存用户界面 end-->
	
	<div id="dlg-buttons">
		<a href="javascript:saveUser()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
		<a href="javascript:closeUserDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
	</div>
</body>
</html>